package connexion;

import java.io.IOException;
import java.io.Serializable;


public class StringMessage implements Message, Serializable{

	public static final String PLACEMENT_FINISHED = "placement finished";
	public static final String GAME_STARTED = "game started";
	public static final String MOVE_PHASE_FINISHED = "move phase finished";
	public static final String SHOOT_PHASE_FINISHED = "shoot phase finished";
	public static final String AGENT_KILLED = "agent killed";
	public static final String NAMING = "name";
	String s;
	String agentConerned=null;
	String reason=null;
	
	public StringMessage(String msg)
	{this.s=msg;}

	public StringMessage(String s, String agt)
	{this.s=s;agentConerned=agt;}
	public StringMessage(String msg, String agt,String reason)
	{this.s=msg;agentConerned=agt;this.reason=reason;}
	@Override
	public String agentConcerned() {
		return null;
	}
	public String toString()
	{
		return reason+" "+s;
	}
	public String getValue() {
		return s;
	}
	public Object getReason() {
		return s;
	}
	
	
	 private void writeObject(java.io.ObjectOutputStream out)
    throws IOException{
		 out.writeObject(agentConerned);
		 out.writeObject(reason);
		 out.writeObject(s);
		 
		 
	 }
private void readObject(java.io.ObjectInputStream in)
    throws IOException, ClassNotFoundException
    {
	 agentConerned=(String)in.readObject();
	 reason=(String)in.readObject();
	 s=(String)in.readObject();
    }
	
	
}
